<template>
	<view>

		<mc-framework navTitle="MES工控机" @changeLevel="changeLevel">
			<template #content>
				<view class="content">
					<z-paging ref="paging" v-model="dataList" @query="queryList" :fixed="false" class="z_paging">
						<!-- 	<view class="item" v-for="(item,index) in dataList" :key="index" @click="itemClick(item,index)">
							<view>点检日期:{{item.BillDate}}</view>
							<view>点检单号:{{item.BillNO}}</view>
							<view>点检设备:{{item.EquipmentName}}</view>
						</view> -->
						<view class="table">
							<table class="table-full">
								<tr>
									<th>烘烤日期</th>
									<th>烘烤单号</th>
									<th>烘烤设备</th>
								</tr>
								<tbody>
									<tr style="border: 1px solid #ccc;" v-for="(item,index) in dataList" :key="index"
										@click="itemClick(item,index)">
										<td>{{item.BillDate}}</td>
										<td>{{item.BillNO}}</td>
										<td>{{item.EquipmentName}}</td>
									</tr>
								</tbody>
							</table>
						</view>
					</z-paging>
				</view>
				<view class="add">
					<u-icon name="plus" color="#fff" size="30" @click="add"></u-icon>
				</view>
				<view class="search">
					<u-icon name="search" color="#fff" size="30" @click="search"></u-icon>
				</view>

				<uni-popup ref="popup" type="bottom" background-color="#fff" border-radius="10px 10px 0 0"
					@change="changePopup">
					<view class="popup-content">
						<view class="popup-content-View">
							<text>设备名称:</text> <text>01号</text>
						</view>
						<view class="popup-content-View">
							<text>开始时间:</text> <text>2024-09-30</text>
						</view>
						<view class="popup-content-View">
							<text>结束时间:</text> <text>2024-09-30号</text>
						</view>
						<view class="bottomBtns">
							<button block @click="submit">
								查 &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 询
							</button>
						</view>

					</view>
				</uni-popup>

			</template>

		</mc-framework>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '1#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '2#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					}, {
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					},
					{
						BillDate: '2024-9-20',
						BillNO: 'sbjklo123456',
						EquipmentName: '3#7890'
					}
				],
				APPFunID: 0,
				tabIndex: 0,
				showLeft: false

			}

		},
		onShow() {
			console.log('ssss');
			this.queryList()
		},
		methods: {
			changePopup() {

			},
			search() {
				this.$refs.popup.open('bottom')

			},
			submit() {

				this.$refs.popup.close('bottom')
			},
			add() {
				let obj = {
					Name: '烘烤详情',
					APPFunID: '烘烤详情'
				}
				let newData = JSON.parse(JSON.stringify(this.$store.state.GuyueModule.ModuleData_select));
				newData.push(obj);
				console.log(JSON.stringify(newData))
				this.$store.commit('GuyueModule/ChangeAndSetStateData', {
					Name1: 'ModuleData_select',
					data: newData
				})
				uni.navigateTo({
					url: './BakingDetail',
					animationType: 'slide-in-right', // 动画类型
					animationDuration: 300 // 动画时长
				});
			},

			queryList(pageNo, pageSize) {
				let that = this
				const params = {
					pageNo: pageNo,
					pageSize: 20,
					type: this.tabIndex + 1
				}
				console.log(JSON.stringify(params))
				that.$refs.paging.complete(that.dataList);
				// that.Request.request('XGD_Procedure', params, function(ret) {
				// 	// console.log(ret)
				// 	if (ret.status == 200) {
				// 		that.$refs.paging.complete(ret.data.ds);
				// 	}
				// })
			},
			itemClick(item, index) {


				let obj = {
					Name: '烘烤详情',
					APPFunID: '烘烤详情'
				}
				let newData = JSON.parse(JSON.stringify(this.$store.state.GuyueModule.ModuleData_select));
				newData.push(obj);
				// console.log(JSON.stringify(newData))
				this.$store.commit('GuyueModule/ChangeAndSetStateData', {
					Name1: 'ModuleData_select',
					data: newData
				})
				// console.log(item);
				uni.navigateTo({
					url: `./BakingDetail?BillNO=${item.BillNO}`,
					animationType: 'slide-in-right', // 动画类型
					animationDuration: 300 // 动画时长
				});
			},
			changeLevel(list, data, row) {
				getchangeLevel(data)

			},
		},


		onNavigationBarButtonTap(e) {
			if (this.showLeft) {
				this.$refs.showLeft.close()
			} else {
				this.$refs.showLeft.open()
			}
		},
		// app端拦截返回事件 ，仅app端生效
		onBackPress() {
			if (this.showRight || this.showLeft) {
				this.$refs.showLeft.close()
				this.$refs.showRight.close()
				return true
			}
		}
	}
</script>

<style lang="scss" >
	@import "../css/index.css";

	.table table tr td {
		border: none;
	}

	.table table tr th {
		border: none;
	}

	.content {
		height: 100%;
		width: 100%;
	}

	.z_paging {
		width: 100%;
		height: 100%;
	}

	.item {
		background-color: #fff;
		margin: 10rpx;
		border-radius: 5rpx;
		padding: 10rpx;

	}

	.item>view {
		width: 50%;
		display: inline-block;

	}

	.add {
		position: fixed;
		bottom: 40px;
		right: 20px;
		width: 40px;
		height: 40px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #51d0d0;
		color: #fff;
	}

	.search {
		position: fixed;
		bottom: 100px;
		right: 20px;
		width: 40px;
		height: 40px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #51d0d0;
		color: #fff;
	}



	.popup-content-View {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 5px 0;
		border-bottom: 2px solid #ccc;
	}
</style>